package com.affablebeans.model.entity;

/**
 * 
 * @author Bora SAYINER
 * @since Jan 26, 2015 10:38:11 PM
 * @version 1.0.0
 */
public class OrderedProduct extends AbstractEntity {

	private Order order;
	private Product product;
	private int quantity;

	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((order == null) ? 0 : order.hashCode());
		result = prime * result + ((product == null) ? 0 : product.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		if (!super.equals(obj)) return false;
		if (getClass() != obj.getClass()) return false;
		OrderedProduct other = (OrderedProduct) obj;
		if (order == null) {
			if (other.order != null) return false;
		} else if (!order.equals(other.order)) return false;
		if (product == null) {
			if (other.product != null) return false;
		} else if (!product.equals(other.product)) return false;
		return true;
	}

	@Override
	public String toString() {
		return "OrderedProduct [order=" + order + ", product=" + product + ", quantity=" + quantity + "]";
	}

}
